package com.fbli.Thread.method;

public class TheadMethod01 {
    public static void main(String[] args) throws InterruptedException {
        //测试相关的方法
        T t = new T();
        t.setName("fbli");
        t.setPriority(Thread.MIN_PRIORITY);//设置线程优先级
        t.start();//启动
        //主线程打印5 hi ,然后我就中断 子线程的休眠
        for (int i = 0; i < 5; i++) {
            Thread.sleep(1000);
            System.out.println("hi" + i);
        }
        System.out.println(t.getName() + "线程的优先级为" + t.getPriority());
        t.interrupt();//中断t线程的休眠
    }
}
class T extends Thread{
    private int count = 0;

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName()+"吃包子"+i);
        }
        try {
            System.out.println(Thread.currentThread().getName()+"休眠中");
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            System.out.println(Thread.currentThread().getName()+"被 interrupt了");
        }

    }
}